﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Event.aspx.cs" Inherits="V2Test.Event" %>

<%@ Register Assembly="Cwing.UI.Validation" Namespace="Cwing.UI.Controls" TagPrefix="cwvf" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body onload="javascript:afterLoad();">
    <form id="form1" runat="server">
    <div>
    </div>
    <p>
        Event Handler:</p>

    <script type="text/javascript">
        function afterLoad() {
            var handler = CW.EventHandler("<%=ValidationTextBox1.ClientID %>", CW.EventType.Before);
            handler.Handler = function(value, result) {
                alert("Hello");
                this.Bubble = false;
                //return false;
            }
            CW.Handler.Add(handler);

            var handler2 = CW.EventHandler("<%=ValidationTextBox1.ClientID %>", CW.EventType.Before);
            handler2.Handler = function(value, result) {
                alert("Hello 2");
            }
            CW.Handler.Add(handler2);
        }        
    </script>

    <cwvf:ValidationTextBox ID="ValidationTextBox1" runat="server" Path="//Control[@ID=&quot;Number&quot;]"
        ValidationSummary="ErrorList1" ValidationType="Client" BackColor="#CC00FF"></cwvf:ValidationTextBox>
    <cwvf:ErrorList ID="ErrorList1" runat="server">
    </cwvf:ErrorList>
    <asp:Button ID="Button1" runat="server" Text="Say Hello Use Before Event" OnClientClick="javascript:return CW.Validate();" />
    </form>
</body>
</html>
